// OGoMojo
// Whitemice.MOGI.MOGIMon
// License: LGPL
// Copyright: Whitemice Consulting, 2006
// Author(s): Adam Tauno Williams (awilliam@whitemice.org)
using System;
using System.Collections;
using Whitemice.MOGI;

namespace Whitemice.MOGI.MOGIMon
{
	/// \brief Interface for MOGIMon pusher plugins
	public interface IPusher
	{
		/// \brief Called once before any change is processed
		void Initialize(IServer server);
		/// \brief Called when an update change occurs
		void Update(string documentName, IEnumerator interestedParties);
		/// \brief Called when an create change occurs
		void Create(string documentName, IEnumerator interestedParties);
		/// \brief Called when a delete change occurs
		void Delete(string documentName, IEnumerator interestedParties);
		/// \brief Called once when MOGIMon service shuts down
		void Shutdown();
	}
}

/*
	Compile a plugin against the Whitemice.MOGIMon.exe as an assembly in order to 
	pickup the Whitemice.MOGI.MOGIMon.IPusher.  Then place the plugin in the 
	directory specified in the MOGOMon stanza of the OGoMojo.ini via the 
	PusherDirectory directive.  Restart the MOGIMon service and it should 
	automatically load your plugin.
	
	Remember that the plugin has access to the configuration via the server's
	GetDirectiveValue({stanza}, {value}) method.
	
	Like:
	mcs {sourcefile} -r:System.Data -r:{PathToMOGIAsselbly}/Whitemice.MOGI.dll \
			-r:{PathToMOGIMonEXE}/Whitemice.MOGIMon.exe \
			-target:library \
			-out:{PusherPluginDirectory}/MorrisonIndustries.Hedera.Pusher.dll
	
	Example:
	mcs Hedera.cs -r:System.Data -r:/usr/local/lib/Whitemice.MOGI.dll \
		-r:/usr/local/bin/Whitemice.MOGIMon.exe \
		-target:library \
		-out:/var/lib/MOGIMon/plugins/MorrisonIndustries.Hedera.Pusher.dll
	
	A common use might be to connect to a database in the 
	IPusher:Initialize method and to update/insert/delete records from 
	tables depending upon object type when a change occurs.  Then nicely 
	close your database connection in th IPusher:Shutdown method.
*/